package com.anyonavinfo.cpaddemo.data.weatherinfo.source.local;

import com.anyonavinfo.cpaddemo.data.weatherinfo.WeatherInfo;
import com.anyonavinfo.cpaddemo.data.weatherinfo.source.WeatherInfoDataSource;

/**
 * Created by ZuiC on 2017/2/8.
 */

public class WeatherInfoLocalDataSource{

    private WeatherInfoLocalDataSourceHelper weatherInfoLocalDataSourceHelper;

    private static WeatherInfoLocalDataSource INSTANCE = null;

    public static WeatherInfoLocalDataSource getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new WeatherInfoLocalDataSource();
        }
        return INSTANCE;
    }


    private WeatherInfoLocalDataSource(){
        weatherInfoLocalDataSourceHelper = new WeatherInfoLocalDataSourceHelper();
    }



    public void saveWeatherInfo(WeatherInfo weatherInfo) {
        weatherInfoLocalDataSourceHelper.saveWeatherInfo(weatherInfo.getCurTemperature(), weatherInfo.getCurWeatherType());
    }

    public void getWeatherInfo(WeatherInfoDataSource.GetLocalWeatherInfoCallBack callBack){
        callBack.onGetLocalWeatherInfo(weatherInfoLocalDataSourceHelper.getWeatherInfo());
    }

}
